package com.yootk.main;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertySource;

import java.util.Map;

/**
 * PropertySource属性源
 */
public class Demo01_PropertySource {
    private static final Logger LOGGER = LoggerFactory.getLogger(Demo01_PropertySource.class);

    public static void main(String[] args) {
        test1();
    }

    /**
     * 使用MapPropertySource
     */
    public static void test1() {
        Map<String, Object> data = Map.of("yootk", "www.yootk.com", "jixianit", "www.jixianit.com");
        PropertySource propertySource = new MapPropertySource("url", data);     // 资源管理
        LOGGER.info("属性资源获取：yootk = {}", propertySource.getProperty("yootk"));
    }
}
